<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>消息</title>
    <link href="../../../css/mui.min.css" rel="stylesheet"/>
    <!--全局css-->
    <link href="../../../css/g.css" rel="stylesheet">
    <!--每个文件对应一个css-->
    <link rel="stylesheet" href="msg.css"/>
    <script>
        document.documentElement.style.fontSize = window.innerWidth / 7.5 + 'px';
    </script>
    <script src="../../../js/mui.min.js"></script>
    <script src="msg.js"></script>
    <script src="test.json"></script>
</head>

<body>
    <header class="mui-bar mui-bar-nav">
        <button class="mui-btn mui-btn-blue mui-btn-link mui-btn-nav mui-pull-left">
            差事帮
        </button>
        <a class="mui-icon mui-icon-plusempty mui-pull-right"></a>
        <a class="mui-icon mui-icon-search mui-pull-right"></a>
    </header>

    <div class="mui-content" style="background-color: darkseagreen;">
        <div class="mui-scroll-wrapper a-top44">
            <div class="mui-scroll" id="msg_content_div">

                <div class="mui-table-view" id="msg_content">
                	                    
                </div>

            </div>
        </div>
    </div>
    <!--有用到再引用-->
    <!--接口-->
    <script src="../../../js/base.js"></script>
    <!--模板-->
    <script src="../../../js/laytpl.js"></script>
    <!--常用方法 dom操作用原生或mui-->
    <script src="../../../js/mq.js"></script>
    <script src="msg.js"></script>

<script>
    mui.init({
        preloadPages: [
        {// 预加载，页面不会出现卡顿
            url: "../postInfo/postInfo.html",// 岗位消息
            id: "postInfo.html",
            extras: {}// 自定义扩展参数
        },
        {
            url: "../signInfo/signInfo.html",// 补签消息
            id: "signInfo.html"
        },
        {
            url:"../singleChat/singleChat.html",// 单聊
            id:"singleChat.html"
        },
        {
            url:"../groupChat/groupChat.html",// 群聊
            id:"groupChat.html"
        }],
        gestureConfig: {
            tap: true, //默认为true
            doubletap: true, //默认为false
            longtap: true, //默认为false
            swipe: true, //默认为true
            drag: true, //默认为true
            hold: true, //默认为false，不监听
            release: true //默认为false，不监听
        }
    });

//  mui.plusReady(function () {
        $$.initScroll();// 滚动
        
        mui.ajax('test.json',{
			data:{
			},
			dataType:'json',//服务器返回json格式数据
			type:'post',//HTTP请求类型
			timeout:10000,//超时时间设置为10秒；
			headers:{'Content-Type':'application/json'},	              
			success:function(data){
				//服务器返回响应，根据响应结果，分析是否登录成功；
				
				var len = data.length;
				var html = "";
				for(var i=0;i<len;i++){
					html += '<li class="mui-table-view-cell mui-media '+ data[i].class +'" data-uid="'+ data[i].uid +'" onclick="app.'+ data[i].method +'();">'+
                        '<a href="javascript:;">'+
                            '<img class="mui-media-object mui-pull-left left_img" src="../../../img/msg/u78.png">'+
                            '<div class="mui-media-body msg_body_left">'+ data[i].title +
                                '<p class="mui-ellipsis">'+ data[i].content +'</p>'+
                            '</div>'+
                            '<div class="mui-media-body msg_body_right_time" >'+ data[i].time +
                                app.msgNumber(data[i].msgNumber);
                            '</div>'+
                        '</a>'+
                    '</li>';
				}
				mui("#msg_content")[0].insertAdjacentHTML("beforebegin",html);
				app.long_down_common();
				app.long_down_chat();
			},
			error:function(xhr,type,errorThrown){
				//异常处理；
				console.log(type);
			}
		});
		
		
//  });
    

	
</script>
</body>

</html>